package com.zxh.system.entity;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.*;
import java.util.List;

/**
 * 角色
 */
@Entity
@Table(name="sys_role")
public class Role extends AbstractIdEntity{
    @Column(length = 50)
    private String name;
    @Column(length = 200,name = "desc_")
    private String desc;

    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @ManyToMany
    @JoinTable(name = "sys_user_role",joinColumns = @JoinColumn(name="roleId",referencedColumnName = "id"),inverseJoinColumns = @JoinColumn(name = "userId",referencedColumnName = "id"))
    private List<User> users;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }
}